package ru.st.selenium.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class MovieDescriptionPage extends InternalPage{

	public MovieDescriptionPage(PageManager pages) {
		super(pages);
	}

	@FindBy(linkText = "Remove")
	private WebElement RemoveButton;
	
	@FindBy(css = "div.maininfo_full + H2")
	private WebElement TitleFilm;
	
	
	public MovieDescriptionPage clickDeleteFilmLink() {
		RemoveButton.click();
		wait.until(alertIsPresent()).accept();
		return pages.movieDescriptionPage;
	}
	
	public MovieDescriptionPage ensurePageLoaded() {
 		//super.ensurePageLoaded();
 		wait.until(presenceOfElementLocated(By.className("maininfo_full")));
 		return this;
 	}
}
